<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>

<body>
    <div id="app">
        <father></father>
    </div>
    <script src="js/vue.js"></script>
    <script>
        Vue.component('father',{
            template:`
                <div>
                    父组件
                    <son1 :money="money"></son1>
                    <son2 :money="money"></son2>
                </div>
            `,
            data(){
                return {
                    money:100 
                }
            },
            components:{
                son1:{
                    props:['money'],
                    template:`
                        <div>
                            子组件1 - {{money}}
                        </div>
                    `
                },
                son2:{
                    props:['money'],
                    template:`
                        <div @click="fn">
                            子组件2 - {{money}}
                        </div>
                    `,
                    methods:{
                        fn(){
                            this.$parent.money = 200 
                        }
                    }
                }
            }
        })
        var vm = new Vue({
            el: '#app',
            data: {},
            methods: {}
        });
    </script>
</body>

</html>